package com.mall.project.sys.controller;

import com.mall.common.core.enums.AuthEnums;
import com.mall.common.core.model.response.ApiResponses;
import com.mall.common.core.model.supers.SuperController;
import com.mall.common.security.annotation.PreAuth;
import com.mall.utils.excel.ExcelData;
import com.mall.utils.excel.ExcelUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 测试接口 前端控制器
 * </p>
 *
 * @author Sam
 * @since 2020-12-27
 */
@Api(tags = {"测试接口"})
@RestController
@RequestMapping("/open/test")
public class TestRestController extends SuperController {

    @PreAuth(AuthEnums.OPEN)
    @ApiOperation("excel解析")
    @PostMapping("/loadExcel")
    public ApiResponses<ExcelData> loadExcel(MultipartFile file) {
        ExcelData excelData = ExcelUtils.importExcelOne(file);
        return success(excelData);
    }
}

